<script setup lang="ts">
import { onMounted } from 'vue';
import { useRouter } from 'vue-router';
// import { useUserStore } from '@/stores/user';

const router = useRouter();
// const userStore = useUserStore();

// 初始化时检查登录状态
onMounted(async () => {
  // if (userStore.isLoggedIn) {
  //   try {
  //     // await userStore.fetchUserInfo();
  //   } catch (error) {
  //     // 获取用户信息失败，可能是token过期，跳转到登录页
  //     router.push('/login');
  //   }
  // }
});
</script>

<template>
  <router-view v-slot="{ Component }">
    <transition name="fade" mode="out-in">
      <component :is="Component" />
    </transition>
  </router-view>
</template>

<style>
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
}

.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>
